#include <iostream>
#include <string>

using namespace std;

int main()
{
    int c = 0;
    string s = "()()()";
    string st = "";
    for (char i: s){
       if (i == '(') st = st + i;
       else
          if (st[st.length()-1] == '(') st.pop_back();
    }

    if (st.length() == 0)
            cout << "true";
    else    cout << "false";
}
